package com.bookshop.user.data;


import com.bookshop.dataOperator.DatabaseUtils;
import com.bookshop.order.logic.OrderManagement;

public class UserRemove implements UserCommonData,CustomerCommonData{

	public boolean remove(String pAccount) {
		String removeUserSql = "delete from " + USER_TABLE + " where "+USER_ACCOUNT+"='"
				+ pAccount + "'";
		String removeCustomerSql = "delete from " + CUSTOMER_TABLE
				+ " where "+ACCOUNT+"='" + pAccount + "'";
		
		boolean result = true;
		result &= DatabaseUtils.excute(removeCustomerSql);
		result &= DatabaseUtils.excute(removeUserSql);
		
		OrderManagement orderManagement = new OrderManagement();
		result &= orderManagement.removeUser(pAccount);
		return result;
	}

}
